package com.personal.website.lottery.web.controller;

import com.personal.website.lottery.web.model.Notice;
import com.personal.website.lottery.web.service.NoticeService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Gavin on 2016/4/3.
 */
@Controller
@RequestMapping("/notice")
public class NoticeController {
    @Resource
    private NoticeService noticeService;

    @RequestMapping("/show")
    public String show(HttpServletRequest request,Model model) {
        int noticeId = Integer.parseInt(request.getParameter("noticeId"));
        Notice notice = this.noticeService.getNoticeById(noticeId);
        model.addAttribute("notice",notice);
        return "notice";
    }
}
